feat: add native Delta Lake scan contrib module (page/row-group pruning) - #5365
feat: add native Delta Lake scan contrib module (page/row-group pruning)#5365dwsmith1983 wants to merge 1 commit into
Conversation
|
Update: pushed two follow-up commits extending the scan's pruning and object-store behavior.
|
888e4a7 to
7fd81aa
Compare
|
HI @andygrove, Can you review this as it adds Delta functionality? |
|
Hi @dwsmith1983 Thanks for putting this together! We are also actively looking at Delta support for Comet, and it'd be great if we can collaborate on this effort! Since #4952 is already approved and close to landing, what do you think about using it as the shared foundation for this work? Ideally, the same In addition, would it also make sense to land this in smaller pieces, for easier review and iterating? For example:
Starting to support this in Spark 4 & Delta 4 would be a useful first milestone. Curious how you see the relationship between the two PRs and whether that direction makes sense to you. Thanks. |
|
Hi @sunchao, On #4952 as the foundation: we already share more than it might look like. This PR builds on part 1 of that same breakup (#4700's CometScanWithPlanData / PlanDataInjector SPI) and keeps #4366's contrib shape, decline-gate philosophy, and test catalog, with co-authored-by credit to both earlier efforts. The remaining overlap is contrib infrastructure, and I'm glad to reconcile it once #4952 lands: adopt its contrib-delta profile and feature naming, the per-Spark delta.version matrix, the verify-gate script, and unify the proto slot (this PR is at 119, #4952 at 118). For the claim hook I'd suggest the generic CometScanRuleExtension SPI from this PR, since it keeps core free of Delta-specific code and the kernel path can register through it the same way. I do see the two read paths as different layers rather than one thing to converge on. By the time CometScanRule sees the scan, delta-spark has already done log replay, time travel, and partition pruning, so this path reuses Comet's existing native parquet scan and gets row-group pruning, page-index pruning, and filter pushdown for free. DVs become ParquetAccessPlans that DataFusion intersects with page-index pruning, so DV skips and page skips compose in one scan. As far as I know no vectorized Delta reader does all of that today, including kernel's, which has no page-index pruning. I'd want convergence to keep this as the default read path, with the kernel path covering what JVM planning can't reach (DSv2, non-Spark frontends, likely CDF and row tracking). On splitting: I'd push back on slicing by feature, for two reasons. First, the features aren't independent. Several decline gates only exist because DVs, column mapping, and Delta's own suites ran together. For example, Delta's findTouchedFiles scan looks like a plain read, and if a basic-reads slice claims it, DELETE silently rewrites files instead of writing DVs. Second, the proof is holistic: this branch runs Delta's own suites at 1156/1156 and the contrib suites at 39/39 on Spark 3.5, 4.0, and 4.1. Feature slices would decline most tables and couldn't run that meaningfully. What I can do is split along review surfaces instead: core SPI additions, native DV decode with its unit tests, the contrib module and read path, and the regression harness and CI, keeping the read path itself (DVs, column mapping, gates) as one reviewable unit. If it lands whole, Comet ships the only vectorized Delta reader with complete skipping. The Spark 4 milestone is already met, the suites are green on 4.0 and 4.1 today. Row tracking and CDF are out of scope here and seem like a natural place for the kernel work to lead. Happy to set up a chat with you and @schenksj to work out the details. |
|
Thanks @dwsmith1983 Your proposed split by review surface sounds reasonable. I agree that the reader, its safety gates, and the essential DML/fallback tests should stay together. Thanks also for being open to aligning with #4952 once it lands. We can leave row tracking and CDF for later discussions rather than expand this PR’s scope. The main additional point I’d like us to settle is keeping experimental Delta support explicitly opt-in. |
Yeah, agreed on explicit opt-in. It's mostly already set up that way. All the Delta code lives in a separate comet-contrib-delta jar that never gets bundled into comet-spark, so a stock Comet install has no Delta surface at all. If we publish that jar with releases, trying it out is just --packages and a conf, nobody has to build from source. Right now the conf defaults to on when the jar is present though, so I'll flip spark.comet.scan.delta.enabled to default false to make the opt-in explicit. The one spot where I'd differ from #4952's gate is the native binary. The Delta bits in libcomet are tiny (DV decoding plus a hand-off to the existing parquet scan, no delta-kernel dependency) and can't be reached without the jar and the conf. I'd rather keep them in the default build than make people compile their own native binary to try an experimental feature. Sound reasonable? |
|
Thanks @dwsmith1983. This makes sense to me! #4952 has just been merged. Could you rebase this PR and adapt to it? Thanks! |
|
@sunchao A few things I deliberately left for discussion rather than deciding unilaterally: unifying the two claim hooks in CometScanRule (CometScanContrib vs the CometScanRuleExtension SPI), conf naming (spark.comet.scan.delta.* vs spark.comet.scan.deltaNative.*), and Maven packaging (the -Pcontrib-delta add-source vs this module's separate jar, which is what keeps the opt-in story build-free). |
sunchao
left a comment
There was a problem hiding this comment.
Thanks for reconciling this with #4952. The generic envelope, separate source roots, and explicit runtime opt-in look like useful progress. I reviewed 9b393c15 and left eight concrete correctness and compatibility comments. The main concerns are unsafe scalar-subquery pushdown, mixed-authority file routing, and unbounded deletion-vector row-selection memory.
I checked these against Spark/Delta source and used bounded stock Spark 4.0.3 / Delta 4.0.0 and isolated Rust probes. I have not built this PR's full JNI library or run cloud-backed end-to-end tests. The Delta CI suites are green on Spark 3.5, 4.0, and 4.1. I am leaving the already-acknowledged claim-hook, naming, and packaging choices for the existing design discussion.
| let (dv_url, dv_store_path) = prepare_object_store_with_configs( | ||
| Arc::clone(&runtime_env), | ||
| dv_path.clone(), | ||
| object_store_options, | ||
| )?; |
There was a problem hiding this comment.
[P2] Avoid constructing a cold S3 store inside the DV runtime
Could we resolve the required stores before entering attach_access_plans, or make their initialization async-safe? The caller enters get_runtime().block_on(...), but an uncached S3 sidecar reaches this synchronous helper and then objectstore/s3.rs calls get_runtime().block_on(build_credential_provider(...)) again. Tokio rejects that nested Handle::block_on with a panic. A fresh executor reading a shallow clone whose data is in bucket A and whose new DV is in bucket B reaches a cold cache entry. Same-bucket tests hide the problem because the data store was created before the outer block_on. Explicit endpoint/region or static Hadoop credentials do not avoid the inner credential-provider call. Please add a test with distinct data-file and DV buckets.
There was a problem hiding this comment.
Fixed by pre-resolution: all stores (data and DV authorities) are resolved on the JNI thread before entering the runtime, and attach_access_plans no longer takes an options map or imports the store builder at all, so the async path structurally can't construct one. Your distinct data/DV bucket scenario is encoded in a new MinIO suite (CometDeltaS3Suite), but heads up that it's docker-gated and hasn't run against a live daemon yet, the contrib CI job has no docker socket so those tests cancel. First live signal needs a Docker environment.
|
Thanks @dwsmith1983. On the design topics you flagged, I’d prefer using |
sunchao
left a comment
There was a problem hiding this comment.
Rechecked 7e09e04f with five independent review scopes. One additional P2 is inline; I also followed up in the existing threads on the remaining scalar-pushdown, Azure DV store, and DV-memory issues. Verification used exact-source Spark/Delta physical-plan probes and locked-dependency Rust probes, not a full Comet/JNI or live cloud run.
|
Hey @sunchao / @parthchandra — are you looking to move this work over to @dwsmith1983’s series? We’re 2 PRs into the 10-PR series now that the contrib modules have been merged. The series fully implements all of the Delta protocols, with all 10k+ Delta test cases passing. I’m fine either way. I won’t have a huge amount of time to work on this over the next couple of months, so it could go faster with a different attendant, but the PRs are ready to roll. You can see the series here: https://github.com/schenksj/datafusion-comet/pulls (PRs #5–13). |
|
Hi @schenksj , I think your series implements Delta native scan based on the I think your series is pretty valuable and should be continued to push forward. At some point we should compare feature coverage and performance between the two. |
|
CI notes for this push: the S3 test base built its client without a region, which aborted CometDeltaS3Suite in CI's empty AWS environment before any test ran; fixed, and since GitHub mounts the Docker socket into job containers the MinIO scenarios will actually execute in CI now. They've been run live locally with all AWS env vars unset (first executions ever, both pass on Spark 3.5 and 4.1; that surfaced a missing spark-hadoop-cloud test dependency, also fixed). Heads up that inside the job container the MinIO endpoint may resolve as unreachable sibling-container networking; the suite now fails soft to canceled rather than aborting the build, and logs the resolved endpoint so the first CI run tells us whether a testcontainers host override is needed. The Spark 4.0 cell wasn't rerun locally, so CI is its first pass over these changes. The Rust 1.98 clippy fix I'd pushed got dropped in favor of #5400 from main during rebase. |
| s.split(",").map(_.trim.toLowerCase(Locale.ROOT)).filter(_.nonEmpty).toSet | ||
| case None => Set("hdfs") | ||
| } | ||
| val unsupportedFsSchemes = scanExec.relation.location.rootPaths |
There was a problem hiding this comment.
[P2] Check selected-file schemes before claiming a shallow clone
Could we apply this filesystem gate to the selected data-file URIs, not just the table's rootPaths? A valid Delta shallow clone can have a supported file: table root while its data files still reference viewfs://review-mount/source/table/.... With the default libhdfs scheme set (hdfs only), both authority checks accept these same-authority files, and the ordinary LongType scan serializes successfully, so the contrib claims it. Native store preparation then fails with Generic URL error: Unable to recognise URL "viewfs://..." instead of leaving the scan with Spark.
At bc98657f, a local-only Spark 4.0.2 / Delta 4.0.0 probe wrote a Delta table through Hadoop's built-in viewfs mount, shallow-cloned it to a local directory, and successfully read [0, 1, 2]. Its actual scan had a file: root and viewfs: selected files. The exact-current authority helpers accepted those files, while the exact native store-preparation helper rejected their URI. This was a stock-engine/exact-helper probe, not a full Comet/JNI run. Checking the schemes of the files actually selected before claiming would preserve Spark fallback for this valid table.
There was a problem hiding this comment.
Fixed. The scheme gate now runs over the selected data-file URIs and the DV absolute paths, the same sequences the later authority gates already collect, using the exact predicate the root-paths gate had (lowercased, null tolerant, libhdfs exemption honored at the new call site). It sits ahead of the multi-store gate since an unreadable scheme is the stronger and more actionable reason, and both authority gates presume the URIs are natively resolvable. s3a is recognized by the native scheme parser so the MinIO coverage is untouched. Your probe is now a CI test: the suite mounts viewfs over a local directory, writes through it, shallow-clones to a file: root, and asserts the scan falls back with the scheme reason while answers match, including a mixed-scheme shape that pins the gate ordering end to end.
|
Reposting the two remaining P2 findings here for visibility. Both remain present at [P2] Check selected-file schemes before claiming a shallow cloneThe filesystem gate checks only the table's This was verified with a real Spark 4.0.2 / Delta 4.0.0 shallow clone that Spark successfully reads, plus the exact native store-preparation helper. Please apply the supported-scheme check to the selected data-file URIs before claiming the scan. Code · Existing discussion and reproduction details [P2] Account for the DV reader's combined-selection allocationConstruction admission and the initial reader clone are now covered. However, DataFusion 54.1 subsequently calls With the default-permitted 1,000,000 alternating deletions across 2,000,000 rows, the current attachment reserves 64,000,000 bytes, but the attached selectors plus reader-normalization allocations peak at 97,554,457 bytes and retain 65,554,432 bytes afterward. Please account for normalization and vector capacity, or avoid the additional allocation through ownership transfer. Simply changing the factor to 3 would still fall below this measured peak. This was reproduced using the unchanged attachment code and the real locked dependency conversion. These are allocator-requested bytes, not RSS or a reproduced executor OOM. Both findings were checked with focused probes and source tracing, not a full Comet/JNI integration run. |
I see value in both (even though it is extra work to maintain both paths) and in principle agree with @sunchao. Ideally, we want to converge these two. Logged an issue based on an AI generated convergence path - #5411 |
Thanks guys. I'm concerned that having 2 will create a lot of confusion when it comes to support.. Even enabling and disabling various scan features is too much to understand for most of the expert data engineers I work with every day. I'm happy to move forward initially in parallel, though like I mentioned before my time to work with this is going to be pretty sparse for the next couple of months. |
|
@schenksj Let’s see how it goes. For now, I see the In terms of your concern, I think we should aim to keep the user-facing configuration simple, perhaps with one flag to enable Delta scans and another to opt into an experimental Rust-kernel-backed path. Ideally, both approaches would share as much integration and testing infrastructure as possible. Really appreciate all your work on this! We’re planning to move quickly with the current |
|
On the macOS scans failure: pulled the hs_err from the run artifact. The crashing thread is a native thread (not a Java thread) that was exiting: the stack is pthread_start into pthread_exit into pthread TSD cleanup, then a jump through a corrupted destructor slot whose value is ASCII string bytes, at 119s elapsed, immediately after ParquetReadFromFakeHadoopFsSuite, the only suite in the group that exercises the libhdfs bridge and its JNI-attached native threads. The Delta code in this PR is structurally unreachable in those suites (native side is dispatch-gated on an operator those plans never emit, and the contrib jar is not on that build's classpath), and the Linux scans group passed on the same commit. My guess is a teardown race in the libhdfs bridge or a runner flake rather than anything this PR executes; the falsifying experiment would be rebuilding the dylib without the delta feature and re-running, since the same crash would exonerate it by construction. Could someone re-run the job? Happy to file the hs_err as an issue either way. |
sunchao
left a comment
There was a problem hiding this comment.
Thanks for addressing the earlier findings. I think the larger file-selection refactor, shared admission/schema cleanup, packaging changes, and broader deployment coverage can be tracked in follow-up PRs. I'd keep the remaining [P1] Azure safety guard, [P2] S3-authentication and AQE lifecycle fixes, and their focused regressions in this PR.
Could we replace spark.comet.scan.deltaNative.enabled with spark.comet.scan.delta.enabled consistently across both Delta contributions, keeping the default false? Please update the config definitions, tests, documentation, and dev scripts together, and use the spark.comet.scan.delta.* prefix for related settings. The intent is one consistent configuration namespace, not another enable flag.
This rename does not depend on changing the separate-JAR packaging. Broader reader-selection behavior can be discussed separately.
| override lazy val outputPartitioning: Partitioning = | ||
| UnknownPartitioning(perPartitionData.length) |
There was a problem hiding this comment.
[P2] Avoid executing adaptive pruning while inspecting partitioning
This getter forces perPartitionData, which calls InSubqueryExec.updateResult(). During AQE, that subquery can still be a non-executable adaptive broadcast placeholder.
A reduced Spark 4.0.2 / Delta 4.0.0 planning harness reproduced this through Spark's normal AQE validation: a DPP join in one UNION ALL branch and a coalescible shuffle in another caused validation to inspect this partitioning before the custom DPP rewrite. It then failed with CometSubqueryAdaptiveBroadcastExec ... does not support the execute() code path. Other operators remained on Spark, and no native Comet reader executed.
Could we return UnknownPartitioning(0) while adaptive placeholders remain and make this a non-lazy def, so the temporary value is not cached? A regression with a query-time dimension filter would help. The current DPP test filters the dimension before writing it, so it does not require dynamic pruning.
There was a problem hiding this comment.
Fixed as described: outputPartitioning is now a plain def returning UnknownPartitioning(0) while any runtime filter still holds an adaptive broadcast placeholder, so AQE validation never forces perPartitionData. Rewrote the DPP test to filter at query time and added your UNION ALL shape as a regression. That shape didn't reproduce the crash pre-fix on my Spark 3.5.9 / Delta 3.3.2 profile, so it likely needs your Spark 4.0.2 harness, but the guard matches your analysis.
|
Agreed on keeping it simple. The conf is now spark.comet.scan.delta.enabled (plus spark.comet.scan.delta.dv.maxDeletedRowsPerFile), so there's one flag to enable Delta scans, and the kernel path can add its own experimental key later. Docs updated. Fixes for the three open threads are pushed as well. |
ec2ad9b to
92ae71b
Compare
637b446 to
cddd9af
Compare
sunchao
left a comment
There was a problem hiding this comment.
Correctness
Re-reviewed cddd9afb1 against 719cba11. The previous P2 is addressed: the helper now preserves scalar-filter presence independently of binding and serialization, and the caller sets has_data_filters even when no predicate survives. Pushdown-disabled and no-scalar-filter paths retain the original common data. Reference-rejected filters still skip updateResult. I found no remaining P1/P2 in this update.
The two regressions check the affected native scan explicitly, require a scalar-subquery expression and an empty planning-time filter payload, and inspect the executed payload for has_data_filters=true with zero predicates. The overflow fixture uses raw TIMESTAMP_MILLIS data, no Delta file statistics, a persisted epoch bound, and disabled EqualNullSafe serialization. This branch uses safe conversion followed by the covering Spark filter. The presence bit does not itself provide a native pruning predicate. The Spark answer comparison is appropriately gated to 4.0+, while the native result is asserted on every profile. Spark 3.5's reference reader can still overflow in this case, consistent with the existing filtered-scan tradeoff.
Validation here is source review, including the maintained Spark 3.5/4.0 and Delta 3.2/4.0 branches. I did not execute the new regressions or rerun benchmarks. The author's before/after execution is a report, not independently reproduced validation. At 05:42 UTC on September 5, all four workflows at this head were action_required, with no head or merge check results. The synthetic merge has the expected base/head parents and the same tree as the reviewed head. Maintained Spark 3.4/4.1 source branches were unavailable, so this review adds no compatibility qualification for them.
Performance
The result object adds no per-row work or additional expression-resolution pass. Disabled pushdown and scans without scalar filters reuse the empty result. The pre-existing additional updateResult call under fused native parents remains unchanged. This fix does not establish globally once-only subquery resolution. No new scan-throughput or pruning improvement is claimed.
Design
Returning presence alongside serialized predicates preserves the shared planner's None versus Some(empty) distinction at the helper boundary. The caller consumes both from one invocation in its lazy serialization path. This is a focused fix that preserves successful pushdown, binding guards, and the covering filter.
Abstraction & complexity
The small result type expresses the two independent outputs without duplicating filter discovery or evaluation. Of 51 feature patches, 48 are unchanged after normalizing blob headers and hunk positions. Only this helper, its caller, and the test suite differ. The intervening base change is an unrelated explode benchmark, and the calendar, DV, planner and cloud-gating implementations retain their previously reviewed source.
c42b2a3 to
2b1047d
Compare
sunchao
left a comment
There was a problem hiding this comment.
Correctness
Re-reviewed head 2b1047d5c2aeacae387535d29a6c1357965bed8f against base 7190df631afe3795914839203c7afe57ea23903c, comparing the update with previously reviewed source cddd9afb1b9f2179e18214a8d12c6b3947f2f96c. This review followed the Delta call sites affected by the updated core scan gates and the intervening base changes.
One new P2 is attached: Delta uses the updated scheme-only probe without core's separate actual-path gate. With a cold file-scheme cache, a supported local Delta table under a newline-containing directory can now be claimed by native execution and fail when object_store decodes the path, instead of retaining Spark's filesystem reader. Maintained Spark 3.5/4.0 SparkPath and Delta 3.2/4.0 TahoeFileIndex preserve the URI encoding passed into the native serializer. This finding is a source control-flow proof, not an executed query reproduction.
The earlier scalar-filter-presence fix and its regression tests are unchanged. Some(empty) still permits safe conversion while retaining the covering Spark filter; it does not establish native pruning. The unchanged DV, read-schema, calendar-rebase and overflow paths introduce no new semantics in this update. This is not a fresh runtime qualification of every type, null, ANSI or boundary combination. Maintained Spark 3.4/4.1 sources were unavailable, so no compatibility claim is made for those versions.
At the authenticated refresh on 2026-09-05 at 21:14 UTC for discussion and 21:15 UTC for CI, all four current-head workflows (CI, CodeQL, PyArrow UDF Tests and Delta Contrib Build Gate) require action; there are no current-head or merge check runs and no current merge SHA. GitHub reports mergeable=false/dirty even though the raw source head's parent is the assigned base. No merge execution is attributed to this review. No local build, component test, query test or benchmark was run; the focused whitespace check passed. The unchanged author-reported test totals do not validate this head.
Performance
The updated Delta resolver normalizes each data/DV URL before deriving its memo key, matching the shared object-store registration key. This adds URL processing per resolution, not per row, while preserving local memoization and the existing configuration-hash/global-cache boundary. The changed Scala gates reuse the planning configuration and selected files. No material additional hot-path issue was established in this update, and no speedup or disabled-path overhead measurement is claimed. Earlier author-reported benchmarks remain historical evidence.
Design
Conservatively declining opted-in vendor S3 aliases is consistent with the existing Delta gates: their configuration-equivalence checks model Hadoop S3A, not the vendor filesystem's consumers. Passing an empty alias set also keeps selected-file checks conservative. However, splitting scheme recognition from path acceptance requires both checks at the contrib boundary because a handled contrib scan returns before core's built-in gates. Applying the existing actual-path check there, with the same libhdfs exemptions, closes the reported failure without changing the extension contract.
Abstraction & complexity
Reusing NativeConfig.parseSchemeSet and the native URL normalizer avoids parallel parsing/key rules. The DV and read-schema abstractions are unchanged. A shared actual-path gate would also prevent core and Delta fallback behavior from drifting; no additional framework or broader refactoring is needed for the attached issue.
| val sch = uri.getScheme | ||
| sch != null && { | ||
| val sl = sch.toLowerCase(Locale.ROOT) | ||
| !libhdfs.contains(sl) && !CometScanRule.isNativelyReadableScheme(uri, Set.empty) |
There was a problem hiding this comment.
Correctness
[P2] Preserve the real-path fallback for Delta scans
isNativelyReadableScheme now probes a synthetic URL such as file:///, so this call no longer checks whether object_store accepts the actual path. Core added a separate objectStoreAcceptsPath root gate, but Delta returns from the contrib hook before that gate, and CometNativeScan.isSupported does not apply it. With native Delta enabled, an otherwise supported local table under a newline-containing directory (URI such as file:///tmp/dir%0A/data) is claimed here; the encoded filename reaches native planning, where object_store 0.13.2 decodes %0A and rejects the control character. Spark's filesystem reader would have remained usable.
The newly introduced case is a fresh JVM with a cold file-scheme cache: the previous helper tested that actual URI and declined it. A previously warmed cache could already hide the old path rejection. Please mirror core's actual-root-path fallback, respecting libhdfs exemptions, and add a Delta regression asserting Spark fallback and the correct answer. This finding is verified from the exact source and locked parser; no full query reproduction was executed.
There was a problem hiding this comment.
Right, the rebase over #5314 dropped that check on the Delta side. Fixed in f1c9b08, which also carries the DataFusion 55 and Arrow 59.2 rebase. objectStoreAcceptsPath is widened to private[comet] the same way isNativelyReadableScheme is, and the contrib applies it at two points in declineReason: on the table root URIs right after the root scheme gate, and on the distinct parent directories of the selected data files and deletion vectors right after the selected-file scheme gate, so a wide selection probes once per directory rather than per file. libhdfs schemes skip it as in core; aliases are declined earlier. The reason string renders the URI with any userinfo masked.
Regressions: unit tests in DeltaScanContribSuite for the rejected root, an ordinary path, and a libhdfs-exempt path with the same character; end to end in CometDeltaNativeScanSuite, a table under a directory whose name contains a newline falls back to Spark with a matching answer, and a shallow clone whose source files sit under such a directory falls back through the selected-directories gate. On the previous head the first of those planned a CometDeltaNativeScan over dir%0A/data.
2b1047d to
f1c9b08
Compare
f1c9b08 to
6608848
Compare
6608848 to
063c9e0
Compare
sunchao
left a comment
There was a problem hiding this comment.
Correctness
Re-reviewed 063c9e0a1eba6eb527edd2315d17e3c430970b52 against base 7f1e00189b1ed86f1cb5acd872d97fce694482b1. The new root-path check addresses the reported newline-directory case, and the selected-directory check also covers the shallow-clone source-directory case. The tests assert Spark fallback and matching answers, with direct parser preconditions in the helper tests.
[P2] Validate complete selected paths for converted Delta tables. One case remains in the existing path-fallback discussion. The selected-path gate drops each filename before probing it. Delta does not always generate those names: CONVERT TO DELTA records existing Parquet paths without renaming the files. For an otherwise supported BIGINT table with no mapping or DVs, an ordinary root such as file:///tmp/table can therefore contain part%0A-000.parquet. Both directory probes accept /tmp/table, while the complete encoded filename reaches native planning and object_store rejects its decoded newline. Spark's filesystem reader remains usable. This case predates the latest fix and is a residual of the same fallback issue, not a new regression from this rebase. Please validate the complete selected paths and add a converted-Parquet regression with the rejected character in the basename.
I verified the conversion and URI-preservation contracts against the maintained Delta 3.2/4.0 and Spark 3.5/4.0 sources, followed the current claim and serialization paths, and checked object_store 0.13.2 against its locked archive checksum. This is a source control-flow proof, not an executed query reproduction. Maintained Spark 3.4/4.1 sources were unavailable. No local build, product test or benchmark was run.
The scalar-filter-presence fix remains intact: Some(empty) permits safe timestamp conversion with the covering Spark filter and does not itself supply native pruning. The calendar and DV implementations retain their prior feature changes. I also checked the DataFusion 55.0.0 reader and schema-builder adaptations against exact locked sources, including the shared structural-narrowing change around the calendar wrapper. This does not requalify all runtime combinations after the dependency update to Parquet 59.3.0.
At the September 8, 01:18 UTC snapshot, all four current-head workflows were action_required, with no head or merge check results. The synthetic merge has the expected base/head parents and the same tree as the reviewed head. Earlier reported test totals and benchmarks are historical evidence.
Performance
The added admission work runs during planning. It constructs parent paths for selected files and deduplicates directories before making uncached native probes, so it adds work proportional to the file list without per-row work. That optimization must still validate filenames admitted through conversion. No measured planning or scan-performance result is claimed.
The revised eager reader uses the same byte-range calls as DataFusion 55's reader. Its metadata hint, eager page-index policy, INT96 stamp and encrypted-file exception remain in place. Calendar wrappers still restrict pruning on wrapped columns, and the established DV reservation tradeoff is unchanged.
Design
Sharing core's actual-path probe at the contrib boundary is appropriate because a handled contribution returns before core's built-in gates. Scheme support and directory validity together do not establish that every selected object can be opened. The admission decision needs to cover the same complete paths that execution consumes, including converted files and external locations.
The DataFusion API adaptations preserve the existing shared planner and reader organization. I found no additional verified design defect in this increment.
Abstraction & complexity
Of 51 feature patches, 44 are unchanged after normalizing blob headers and hunk positions. The remaining changes comprise the fallback helper and tests, its core visibility change, and dependency/base integration. The shared schema adapter still applies calendar handling after remapping and beneath casts.
The new helper is small, but its UUID-filename assumption is stronger than Delta's actual file contract. Correcting that boundary does not require a new extension API or a broader reader refactor. This updates the existing P2; no duplicate inline thread is added.
063c9e0 to
60dbe45
Compare
sunchao
left a comment
There was a problem hiding this comment.
Correctness
Re-reviewed 60dbe45a61c0f29e4a75306c1969334dbf91fd59 against bb9e74020adc228e486f6f4d0fa68292b30bff31. All 51 feature files are byte-identical to the previously reviewed 063c9e0a, and their feature patches are unchanged apart from hunk coordinates and blob indexes. The seven-file head delta matches the upstream base delta.
[P2] The complete selected-path fallback issue remains. The selected-path gate still removes filenames before validation. CONVERT TO DELTA preserves existing Parquet names, so a rejected character in a basename can pass both directory checks and fail after native claim. Please validate complete selected paths and add a converted-Parquet fallback regression. This updates the existing P2, with no duplicate inline thread.
The current claim, URI serialization and native parsing paths still support this source-level finding. I rechecked the maintained Delta 3.2/4.0 and Spark 3.5/4.0 contracts and reused the exact locked object_store source evidence. The dependency lockfile is unchanged. The scalar-filter presence fix and existing calendar/DV behavior remain intact. No new P1/P2 finding emerged from this follow-up.
At September 8, 10:35 UTC, all four current-head workflows were action_required, with zero jobs and no check results. The synthetic merge has the expected base/head parents and the same tree as this head. No local build, product test or benchmark was run. Spark 3.4/4.1 maintained sources remain unavailable. Historical test totals and timings are not current-head validation.
Performance
The rebase adds no Delta-specific work. Directory deduplication still avoids repeated planning probes for the same parent, but it does not validate preserved filenames. The existing DV memory and calendar-pruning tradeoffs are unchanged, with no new measurements.
Design
The opt-in module, shared native reader and Spark fallback design are unchanged. The remaining fix belongs at admission so selected paths the native reader cannot open decline before execution.
Abstraction & complexity
No new Delta abstraction appears in this rebase. Complete-path validation can remain in the existing eligibility helper. That boundary check does not require a new extension API or a separate reader ownership layer.
0f56322 to
661c24a
Compare
sunchao
left a comment
There was a problem hiding this comment.
Correctness
Re-reviewed 288cf0731c4677df48e7ce82b3045d1b69867163 against base 8e6846850c525506dd2b9194f2014e8acd2ab60a, which is also the actual merge base. All 51 authored patches match the last published review after normalizing diff metadata, and all 51 authored file blobs equal the previous unpublished head. The intervening concat_ws array support and Spark 4.1 Variant test-fixture update are inherited verbatim from the base. The new expression routing leaves Delta admission, filter-presence serialization, and native file preparation unchanged.
[P2] Complete selected-path validation is still required. The gate still strips basenames before validation. Maintained Delta 3.2/4.0 conversion preserves existing Parquet names, and maintained Spark 3.5/4.0 preserves their URI encoding. An unsupported basename can pass directory validation and fail during native file preparation. Please validate complete selected paths and add a converted-Parquet fallback regression. The existing P2 remains unresolved. No new P1/P2 emerged.
At September 8, 16:56 UTC, all four current-head workflows were action_required, with no head or merge check results. The synthetic merge has the expected base/head parents and equals the head tree. This is a source review with verified reuse of unchanged source and discussion evidence. No build, product test, or benchmark ran locally. Maintained Spark 3.4/4.1 sources remain unavailable. The inherited test changes do not establish runtime qualification.
Performance
Delta file listing, directory deduplication, and deletion-vector reservations are unchanged. The inherited concat_ws adapter handles runtime scalars once for broadcasting. Its benchmark source provides no measured Delta speedup here.
Design
The existing admission helper can reject complete paths before native execution. The inherited expression routing retains the previous string kernel and does not alter the Delta extension boundary.
Abstraction & complexity
No Delta-specific abstraction was added. The remaining correction fits the eligibility helper without changing reader ownership or the extension API.
|
@andygrove the restructure you asked for is complete: #5653 merged, #5654 split out, and the case folding comes from #5602. The changes-requested predates that; could you take another look when you get a chance? |
sunchao
left a comment
There was a problem hiding this comment.
Correctness
Re-reviewed a51cc0c2b680074bd7966c6e3aa9d20c517ab624 against fefee03d94045ecd0ac5d3a1edb98a555f5ff21d, which is also the merge base. The 51 existing authored file patches retain the same added and removed lines. The only additional authored change supplies false, "CORRECTED", "CORRECTED" to two Parquet test constructors introduced by the rebase. These correctly keep the ordinary-reader fixtures outside Delta's per-file calendar-rebase path.
The inherited runtime-filter integration preserves the file groups, deletion-vector extensions and expression adapter when replacing a Parquet source. It remaps predicates through the scan projection and combines them with the existing predicate. Both native Delta scanning and join dynamic filtering remain opt-in. Reader attachment is limited to eligible inner integer-key joins and does not cross a fetch limit or a residual expression beyond direct-column null checks. Source inspection found no new issue with the existing column-mapping, deletion-vector or fallback boundaries.
[P2] The complete selected-path check remains outstanding. DeltaScanSupport still validates parent directories after removing the filenames. Maintained Delta 3.2/4.0 conversion preserves existing Parquet basenames, and maintained Spark 3.5/4.0 preserves their URI encoding. A basename rejected by the locked native path parser can therefore pass admission and fail during native file preparation. Please validate the complete selected paths and add the converted-Parquet fallback regression described in the existing thread. No duplicate inline or new P1/P2 is added.
Validation
The synthetic merge ef9453744c74e59ec8dab2dbe50f99cdf0dc9a3a has the exact base/head parents and equals the head tree. At September 9, 04:15 UTC, CI, the Delta build gate, CodeQL and PyArrow workflows were all action_required, with no jobs. The sole successful check was the labeling workflow, which checked out the base. No current-head build or test execution is established. This follow-up uses verified source equivalence and focused source inspection. No local build, query test or benchmark ran. Maintained Spark 3.4/4.1 sources remain unavailable.
Performance
The Delta listing, schema adaptation, deletion-vector preparation and calendar-rebase implementation are unchanged. The inherited opt-in runtime filter clones scan configuration while preserving the adapter and attached DV extensions. No new default-path scan cost was identified in this update. The unchanged benchmark numbers remain author reports and do not establish a measured benefit at this head.
Design
The rebase keeps runtime filtering inside the existing Parquet pushdown contract and preserves the residual filter. The remaining path correction belongs in admission, where it can still choose Spark fallback before native file preparation fails.
Abstraction & complexity
The update adds no Delta-specific abstraction. The two explicit test-constructor settings match the extended reader API without changing the Delta configuration or ownership interfaces.
andygrove
left a comment
There was a problem hiding this comment.
All five of the points I raised on 2 September are resolved. The case-folding stack is gone and the Delta scan now inherits main's name_fold ASCII fast path from #5602, the per-scan case tables and the QueryContextInternerSuite pin went with it, JvmLowercaseParitySuite is gone, the three small core fixes shipped as #5653, the field-id semantics moved to #5654, the reserved "delta_scan" line in operator.proto is dropped, and the doc comments in DeltaScanSupport.scala no longer reference symbols that are not in the tree. The core surface that remains is datetime_rebase.rs and its wiring, which the description calls out and tracks under #5010 and #5662. I traced the off switch and it holds: rebase_from_file_metadata is false at every call site except delta_spark_scan.rs, so a plain NativeScan is unchanged. Thanks for doing the split.
The restructure has left one thing stale. dev/verify-contrib-delta-gate.sh exists to prove that "the DEFAULT cargo / mvn / dylib build carries ZERO Delta surface" and asserts zero Delta symbols in the default libcomet. With delta now in default = ["hdfs-opendal", "delta"], that statement is no longer accurate, since the default dylib carries delta_dv.rs, delta_spark_scan.rs, roaring and crc32fast. The gate still reports OK only because delta_syms greps for comet_contrib_delta|delta_kernel|deltadvfilter|deltasynthetic and none of the new symbols match those names. Could the script and the header comment in .github/workflows/delta_build_gate.yml be reworded to the invariant that actually holds now, and could the gate pin the new one, for example that --no-default-features pulls in neither roaring nor crc32fast and that the default-on surface stays near the 82 KB you measured? Nothing in CI has run on this head, so that gate has not been exercised either way.
The other change outside the module is in pom.xml. The new <ignoreClass>org.apache.comet.*</ignoreClass> for comet-common-spark... sits in the root <build> enforcer configuration rather than inside the delta profile, so it turns off duplicate-class detection for every Comet class in every build, to work around a reactor collision that only happens under -Pdelta. Would excluding the transitive comet-common from contrib/delta-spark's comet-spark dependency work instead? The shaded jar already bundles those classes, so the module should still compile and the repo-wide check would stay intact.
On the default cargo feature, @viirya asked for a maintainer call rather than another round, so here is mine. I am fine keeping delta in the default set at 82 KB, given the code is unreachable without both the contrib jar and spark.comet.scan.delta.enabled, and I would rather people can try this against a stock binary than have to build native themselves. Please treat that as settling #5411's opposite ask and keep the Cargo.toml comment pointing at it.
I did not re-review the contrib itself, since @sunchao has been through it many times, but I did check the two things in the read path I care about most and both hold. ParquetAccessPlan::scan_selection intersects with an existing Selection rather than overwriting it, so a DV selection survives page-index pruning, and SparkDatetimeRebaseExpr is opaque to PruningPredicate, so a rebased column loses pruning instead of pruning wrongly. Throwing on RowIndexFilterType.IF_NOT_CONTAINED in extractDvDescriptor is the right call too. @sunchao's selected-path finding around DeltaScanSupport.scala:318 still looks open at this head, so I am leaving this as a comment for now. The reason for my earlier changes-requested is gone and I will switch to approve once that and the build-gate question are settled.
sunchao
left a comment
There was a problem hiding this comment.
Correctness
Rechecked b1de375d against 424c31aa after the latest review. All 52 authored file patches retain the added and removed lines from the last published review at a51cc0c2. The 22-file increment since then is inherited from base updates. The latest six-file base change enables FIRST/LAST partial merging above any scan. Its overlap in operators.scala leaves the authored Delta scan-metric changes intact. I found no new Delta-specific issue in that interaction.
[P2] The complete selected-path check remains outstanding. DeltaScanSupport still removes basenames before validating selected paths. Maintained Delta 3.2/4.0 conversion preserves existing Parquet basenames, and maintained Spark 3.5/4.0 preserves their URI encoding. Native file preparation still parses each complete path. The root/directory fix therefore does not cover the converted-file case in the existing discussion. Please validate complete selected paths while fallback remains possible and add the converted-Parquet regression. I am not adding a duplicate inline.
The Delta/DV/rebase sources and locked dependencies are unchanged from the inspected revision. The retained exact-release source evidence still supports DV/page-selection intersection and conservative fallback for unsupported rebase predicates. Delta enables per-file rebasing, ordinary NativeScan disables it, and encoded inverse DV filter types remain rejected.
At 16:10 UTC on September 9, CI, the Delta build gate, CodeQL and PyArrow remain action_required, each with zero jobs. The only successful job performed labeling and its log confirms checkout of base 424c31aa. Synthetic merge cdcb83e2 has the assigned base/head parents and equals the head tree, but no build/test execution of that tree is established. This review used source comparison and reused checksum-verified dependency/enforcer evidence after checking source and lock equivalence. No native/JVM test, build gate or benchmark was run. Maintained Spark 3.4/4.1 sources remain unavailable.
Performance
The maintainer's decision settles keeping delta in the default native feature set. The contrib jar and scan setting still gate use, and this rebase does not change the authored scan, DV or calendar-rebase implementation. The approximately 82 KB size increase and scan timings remain author-reported measurements. The current gate compares defaults against defaults plus contrib-delta, so that comparison does not independently measure the cost of the separate delta feature.
Design
The build-gate request remains applicable. Its workflow still promises zero Delta surface, while delta_syms matches comet_contrib_delta|delta_kernel|deltadvfilter|deltasynthetic, which does not match delta_dv or delta_spark_scan. Also, the dependency tree labeled default is obtained with --no-default-features, whereas the later default-library build enables defaults. Please align the wording and checks with the accepted distinction between the default JVM-planned Delta support and the optional kernel contrib.
A blanket assertion that --no-default-features contains no crc32fast would be incorrect: core depends unconditionally on the shuffle crate, which has its own unconditional crc32fast dependency. Check Delta-specific feature activation and opt-out instead of global package-name absence. Any size comparison intended to isolate delta should otherwise keep the feature set identical.
Abstraction & complexity
The duplicate-class concern also remains, with a narrower scope than the review's wording suggests. The ignore is specific to the comet-common artifact, as confirmed in the configured enforcer 1.7.0 implementation and its per-dependency rule contract. It does not disable checks for every Comet class in arbitrary artifacts. However, placing it in the root build makes that common-artifact exception apply outside the Delta profile. Please contain it in the contrib module/profile or remove the duplicate dependency path there. Excluding transitive comet-common is plausible for the shaded-jar path, since shading bundles it at package. Please validate clean reactor test and package lifecycles before relying on that alternative. I have not built the proposed exclusion.
|
Both items are in the head (5903eb0). Selected paths: Duplicate classes: the root pom no longer carries the comet-common exception. The exclusion alternative packages fine but fails the reactor test lifecycle with |
sunchao
left a comment
There was a problem hiding this comment.
Correctness
Rechecked 5903eb03229738f21514f32bd77fc32134c7e17d against 424c31aa79d13fddf743ffa29bae3c6f146e6c5e after review 5156929953. The base is unchanged. I read the six-file increment and reused the prior review for the 46 unchanged authored files. I found no new or remaining verified P1/P2 findings and approve this revision.
The selected-path P2 is addressed. The gate now probes complete selected data-file and external-DV URIs before conversion, with deduplication and the existing libhdfs exemptions. This matches maintained Delta 3.2/4.0 preserving converted Parquet basenames and maintained Spark 3.5/4.0 preserving URI encoding. The new converted-Parquet regression checks the absence of a native Delta scan, the matching Spark answer and a fallback reason containing the rejected basename. The helper test also checks that the parent passes while the complete filename fails, so an unavailable native parser cannot make that test pass vacuously.
At 2026-09-09T19:35:30Z, CI, Delta Build Gate, CodeQL and PyArrow still require maintainer action and have zero jobs. Only labeling passed, on base 424c31aa. Synthetic merge 0bfe12ad has the assigned parents and the same tree as HEAD, but no product test ran on it. The author's reported query and reactor runs are separate from this evidence. I ran only the Maven inheritance component check described below. No native/JNI query or benchmark was run. Maintained Spark 3.4/4.1 source coverage remains unavailable.
Performance
Full-path validation adds one uncached native parse per distinct selected URI, replacing the directory-only probe. The source confirms that the probe performs URL/path parsing without storage I/O, and the existing planning helper is reused rather than listing files again. The reported 0.75 microseconds per file over 200,000 paths is an author measurement, not an independently measured end-to-end planning cost. The benchmark file changes are comments only, and the native scan/DV/rebase implementations are unchanged.
Design
The earlier build-gate request remains open. The script and workflow are unchanged, so a reported passing run does not settle it: the workflow still promises zero default Delta surface, the symbol pattern still omits the new delta_dv/delta_spark_scan surface, and the tree labeled default still disables default features. Please align the wording and checks with the accepted default delta versus optional kernel contrib-delta split. A size comparison should isolate the intended feature, and global crc32fast absence is not a valid opt-out test because shuffle also depends on it. That existing maintainer request remains open. This approval does not mark it resolved, and I am not adding a duplicate inline.
Abstraction & complexity
The duplicate-class scope request is addressed. The exception is removed from the root and appended to the Delta module's existing enforcer execution. Using the repository's pinned Maven 3.9.6 inheritance implementation against the exact POMs, I verified one inherited enforce execution, preservation of the parent's four dependency exceptions and other rules, and the additional common-artifact exception only in Delta. Root, Spark and common remain unchanged by that child configuration. This was a model-inheritance component check, not full effective-model resolution, enforcer execution or clean reactor test/package validation. The module-local exception avoids imposing this workaround on unrelated builds.
andygrove
left a comment
There was a problem hiding this comment.
The pom item is resolved, and the way you resolved it is better than the alternative I suggested.
The root <build> enforcer no longer carries org.apache.comet.*; it is back to UnusedStubClass and TypeQualifier only, and the exception now lives in contrib/delta-spark/pom.xml under the same execution id with combine.children="append", so it extends the inherited rule for that module alone. Thanks for actually trying the dependency-exclusion route and reporting why it fails: a reactor test run resolving comet-spark from unshaded target/classes and then hitting NoClassDefFoundError: org/apache/comet/CometRuntimeException is a good reason, and it is the sort of thing that would otherwise be re-proposed every six months.
The build gate is still stale, though, and I owe you a correction on part of what I asked for.
What I got wrong
I suggested pinning that --no-default-features pulls in neither roaring nor crc32fast. That invariant does not exist and never did. Both crates are already in the tree transitively without the delta feature:
crc32fast v1.5.1
├── apache-avro v0.21.0 -> iceberg v0.10.1 -> datafusion-comet
└── datafusion-comet-shuffle -> datafusion-comet
roaring v0.11.5
└── iceberg v0.10.1 -> datafusion-comet
So delta = ["dep:roaring", "dep:crc32fast"] adds no new crate to the default build; it only promotes two existing transitive deps to direct ones. That strengthens your case for keeping delta in the default set, and it should go in the Cargo.toml comment next to the #5411 pointer, because "it pulls in two extra crates" is the objection a reader will otherwise assume.
What is still wrong
The gate conflates the two features. dev/verify-contrib-delta-gate.sh's header says it verifies that the build "keeps Delta surface out of default builds" and that layer 1 checks "default cargo build doesn't compile comet-contrib-delta". Neither statement matches the tree:
default = ["hdfs-opendal", "delta"], anddeltagates real code,delta_dv.rsplus eight#[cfg(feature = "delta")]sites inplanner.rs. So the default dylib does carry Delta surface. The header claims otherwise.- Layer 1 runs
cargo tree -p datafusion-comet --no-default-featuresand calls that the default build. It is not: the default tree has 30opendallines against 25 without default features, so the command under test is a configuration nobody ships.
The check's substance is fine and I verified it holds where it matters. comet-contrib-delta and delta_kernel are absent from the actual default tree, not just from the --no-default-features one:
default tree contains contrib-delta/delta_kernel: 0
--no-default-features tree contains them: 0
So the fix is small: point layer 1 at cargo tree -p datafusion-comet with no flag, and reword the header and the .github/workflows/delta_build_gate.yml comment to the invariant that actually holds, which is that the heavy kernel-backed contrib-delta crate stays out of every shipped build while the small default-on delta feature is deliberately in. Keeping --no-default-features as an additional case is fine, it just is not the one the prose describes.
The delta_syms grep is the other half. It matches comet_contrib_delta|delta_kernel|deltadvfilter|deltasynthetic, none of which the default-on delta code exports, so the symbol layer reports OK for the same reason the tree layer does, not because the default build is Delta-free. Pinning the default-on surface near the 82 KB you measured would make that layer say something the grep cannot drift away from.
On the selected-path finding, probing every distinct data-file and deletion-vector URI rather than their parents is the right shape, and 0.75 microseconds per file as a pure URL parse with no I/O is comfortably under the scan's own per-file cost. The CONVERT TO DELTA test with a newline in a retained basename is a good regression, and better than a synthetic one because it is how the shape actually arises.
Everything else from my last pass still holds. ParquetAccessPlan::scan_selection intersecting rather than overwriting, SparkDatetimeRebaseExpr being opaque to PruningPredicate, and throwing on RowIndexFilterType.IF_NOT_CONTAINED are all still correct at this head, and my maintainer call on keeping delta default-on stands, now with a better justification than the one I gave.
Happy to approve once the gate says what it checks.
andygrove
left a comment
There was a problem hiding this comment.
The pom item is resolved, and the way you resolved it is better than the alternative I suggested.
The root <build> enforcer no longer carries org.apache.comet.*; it is back to UnusedStubClass and TypeQualifier only, and the exception now lives in contrib/delta-spark/pom.xml under the same execution id with combine.children="append", so it extends the inherited rule for that module alone. Thanks for actually trying the dependency-exclusion route and reporting why it fails: a reactor test run resolving comet-spark from unshaded target/classes and then hitting NoClassDefFoundError: org/apache/comet/CometRuntimeException is a good reason, and it is the sort of thing that would otherwise be re-proposed every six months.
The build gate is still stale, though, and I owe you a correction on part of what I asked for.
What I got wrong
I suggested pinning that --no-default-features pulls in neither roaring nor crc32fast. That invariant does not exist and never did. Both crates are already in the tree transitively without the delta feature:
crc32fast v1.5.1
├── apache-avro v0.21.0 -> iceberg v0.10.1 -> datafusion-comet
└── datafusion-comet-shuffle -> datafusion-comet
roaring v0.11.5
└── iceberg v0.10.1 -> datafusion-comet
So delta = ["dep:roaring", "dep:crc32fast"] adds no new crate to the default build; it only promotes two existing transitive deps to direct ones. That strengthens your case for keeping delta in the default set, and it should go in the Cargo.toml comment next to the #5411 pointer, because "it pulls in two extra crates" is the objection a reader will otherwise assume.
What is still wrong
The gate conflates the two features. dev/verify-contrib-delta-gate.sh's header says it verifies that the build "keeps Delta surface out of default builds" and that layer 1 checks "default cargo build doesn't compile comet-contrib-delta". Neither statement matches the tree:
default = ["hdfs-opendal", "delta"], anddeltagates real code,delta_dv.rsplus eight#[cfg(feature = "delta")]sites inplanner.rs. So the default dylib does carry Delta surface. The header claims otherwise.- Layer 1 runs
cargo tree -p datafusion-comet --no-default-featuresand calls that the default build. It is not: the default tree has 30opendallines against 25 without default features, so the command under test is a configuration nobody ships.
The check's substance is fine and I verified it holds where it matters. comet-contrib-delta and delta_kernel are absent from the actual default tree, not just from the --no-default-features one:
default tree contains contrib-delta/delta_kernel: 0
--no-default-features tree contains them: 0
So the fix is small: point layer 1 at cargo tree -p datafusion-comet with no flag, and reword the header and the .github/workflows/delta_build_gate.yml comment to the invariant that actually holds, which is that the heavy kernel-backed contrib-delta crate stays out of every shipped build while the small default-on delta feature is deliberately in. Keeping --no-default-features as an additional case is fine, it just is not the one the prose describes.
The delta_syms grep is the other half. It matches comet_contrib_delta|delta_kernel|deltadvfilter|deltasynthetic, none of which the default-on delta code exports, so the symbol layer reports OK for the same reason the tree layer does, not because the default build is Delta-free. Pinning the default-on surface near the 82 KB you measured would make that layer say something the grep cannot drift away from.
On the selected-path finding, probing every distinct data-file and deletion-vector URI rather than their parents is the right shape, and 0.75 microseconds per file as a pure URL parse with no I/O is comfortably under the scan's own per-file cost. The CONVERT TO DELTA test with a newline in a retained basename is a good regression, and better than a synthetic one because it is how the shape actually arises.
Everything else from my last pass still holds. ParquetAccessPlan::scan_selection intersecting rather than overwriting, SparkDatetimeRebaseExpr being opaque to PruningPredicate, and throwing on RowIndexFilterType.IF_NOT_CONTAINED are all still correct at this head, and my maintainer call on keeping delta default-on stands, now with a better justification than the one I gave.
Happy to approve once the gate says what it checks.
|
The pom item is resolved, and the way you resolved it is better than the alternative I suggested. The root The build gate is still stale, though, and I owe you a correction on part of what I asked for. What I got wrongI suggested pinning that So What is still wrongThe gate conflates the two features.
The check's substance is fine and I verified it holds where it matters. So the fix is small: point layer 1 at The On the selected-path finding, probing every distinct data-file and deletion-vector URI rather than their parents is the right shape, and 0.75 microseconds per file as a pure URL parse with no I/O is comfortably under the scan's own per-file cost. The Everything else from my last pass still holds. Happy to approve once the gate says what it checks. |
Adds an optional contrib/delta-spark module that claims delta-spark DSv1 scans through CometScanContrib and runs them on Comet's shared native parquet path, including main's JVM-exact field-name folding for case-insensitive footer matching. Deletion vectors are decoded natively into per-file ParquetAccessPlans that DataFusion intersects with row-group and page-index pruning, so DV skips and page skips compose in a single scan. Scans the native path cannot serve safely (DML row-index reads, unsupported filesystem schemes, userinfo-bearing authorities, credential-provider-only auth, S3 config divergence, multi-store shapes) fall back to Spark with an explained reason. Co-authored-by: Scott Schenkein <schenksj@yahoo.com> Co-authored-by: Aditya Vaish <adivaish@microsoft.com>
Which issue does this PR close?
Part of #174. This PR does not close it: the delta-kernel contrib and the convergence discussion in #5411 are tracked there as well.
Rationale for this change
Adds an optional contrib module that plans Delta Lake table scans on the JVM and executes them natively, including deletion vector application inside the native scan. delta-spark has already done log replay, snapshot resolution, and partition pruning by the time CometScanRule sees the FileSourceScanExec, so there is no Delta planning to do natively: the scan reuses the existing ParquetSource path and gets row group pruning, page index pruning, and filter pushdown for free, with deletion vectors composed into the ParquetAccessPlan so DV skips and page skips intersect rather than filtering after the read.
The module is explicit opt in: the
-PdeltaMaven profile builds a separatecomet-contrib-deltajar that is never bundled intocomet-spark, andspark.comet.scan.delta.enableddefaults to false. Thedeltacargo feature (DV decoding plus the planner hand-off, no delta-kernel dependency, about 82 KB of dylib) stays in the default native build so trying the contrib needs only the jar and the config, not a custom native binary; this was agreed in review and is recorded in the Cargo.toml comment. The adjacentcontrib-deltafeature is unrelated: it gates the delta-kernel integration and default builds carry no kernel surface.Restructured after review
Core changes that previously traveled with this PR now live elsewhere:
${...}expansion, constant metadata field uniquification, and dead JNI removal: fix: expand object store option references, uniquify constant metadata names, drop dead parquet JNI #5653, now merged. The first two are prerequisites of this module and this branch is rebased on top of them.Two core-generic capabilities remain in this PR because the native read path does not have them yet and the Delta scan needs them for correctness; both are candidates to lift into core, tracked in #5662 (S3 configuration divergence for the regular native scan) and #5010 (calendar rebasing for the regular native scan):
fs.s3a.assumed.role.policy) decline outright since Hadoop sends them in the AssumeRole request and native does not.What changes are included in this PR?
contrib/delta-spark: DeltaScanSupport (scan eligibility, S3 divergence gating, DV descriptor extraction), CometDeltaNativeScan serde, service registration via the contrib scan SPI, documentation.delta_dv.rs(deletion vector decode with a full malformed input matrix, and access plan construction),delta_spark_scan.rsplanner arm,datetime_rebase.rs, proto messages for the Delta scan envelope, S3 object store helper.build_parquet_scan_plan/prepare_scan_store_and_filesextraction in the planner,object_store_url_key/prepare_object_store_with_config_hash,buildNativeScanCommonextraction,reportScanInputMetrics,hasScanInputwidening, contrib LinkageError containment.Follow-up work from review is tracked in #5655 (DV file splitting), #5656 (compressed DV decoding), #5657 (overlapping bitmap and footer reads), #5658 (shared cloud compatibility helper), #5659 (credential scoping), #5660 (v2 checkpoint coverage), #5661 (capability table), and #5662.
How are these changes tested?
--features delta(343 in the core crate), including the DV malformed input matrix (truncation at every boundary, CRC and magic corruption, size and cardinality lies, bit flip sweeps), the calendar rebase unit tests against Spark's own anchors, and end to end scan pins for per file metadata resolution; clippy and fmt clean.Benchmarks at the current head
Apple M5, JDK 17, Spark 3.5 profile, local filesystem, 120M rows in 6 files of about 490 MB (zstd), full table aggregate touching every surviving row, medians of 5 warm runs per fresh session. Results are bit identical across all modes and verified against closed form expectations.
DV decoding is negligible in every pattern; the cost center is selector expansion for alternating deletes (61 to 93 ms and about 400 MB peak per file). The default
spark.comet.scan.delta.dv.maxDeletedRowsPerFilecap (1M) declines the contiguous and alternating tables up front and falls back cleanly, which the numbers show is the better path for alternating; raising the cap without sizing the off heap pool fails tasks at the reservation by design.The calendar rebase wrapper costs 0.7 to 2.2 ns per row and is noise at scan level, but it is opaque to pruning: a selective predicate on a rebased column decoded 65x more rows than with pruning live on a sorted table. That is the tradeoff of the legacy path and only applies to files that need rebasing.
An independent run on public data (NYC taxi with a DV delete) is in the PR discussion and confirmed exact DV row removal with timing parity.